package com.wang.IO;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 用于单行io处理:
 * 类型 1,2,3 或者 a,b,c,d
 * 分别支持转为数组,ArrayList
 */
public class OneLineNoBrace {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        OneLineNoBrace oneLine = new OneLineNoBrace();
        String[] strings = oneLine.braceAndCommaReturnString(s);//转为字符串数组
        Integer[] integers = oneLine.braceAndCommaReturnInteger(s);//转为整数数组
        List lists = oneLine.braceAndCommaReturnArrayList(s);

    }
    /**
     * 带花括号+逗号分隔
     * {a,b,c,d}
     * 返回字符串数组
     */
    public String[] braceAndCommaReturnString(String s){
        //去除两边花括号,以逗号分隔存入数组String
        String[] ss = s.split(",");
        return ss;
    }

    /**
     * 带花括号+逗号分隔
     * {1,2,3,4}
     * 返回Integer[]数组
     */
    public Integer[] braceAndCommaReturnInteger(String s){
        //去除两边花括号,以逗号分隔存入数组String
        String[] ss = s.split(",");
        Integer[] integers = new Integer[ss.length];
        Integer index = 0;
        for (String s1:ss) {
            integers[index++] = Integer.valueOf(s1);
        }
        return integers;
    }
    /**
     * 带花括号+逗号分隔
     * {1,2,3,4}
     * 返回Integer[]数组
     */
    public List braceAndCommaReturnArrayList(String s){
        //去除两边花括号,以逗号分隔存入数组String
        String[] ss = s.split(",");
        List<String> list = new ArrayList<>();
        for (String s1:ss){
            list.add(s1);
        }
        return list;
    }
}
